# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Fabio Ribeiro <fabiorphp@gmail.com>
pkgname=php7-pecl-stats
_extname=stats
pkgver=2.0.4
pkgrel=0
pkgdesc="PHP 7 extension that provides few dozens routines for statistical computation."
url="https://pecl.php.net/package/stats"
arch="all !s390x" # too many tests fails on s390x
license="PHP-3.01"
depends="php7-common"
makedepends="php7-dev"
_commit="fac78cf926bb00c9974379c7131c58b7545e5b15"
source="php-pecl-$_extname-$_commit.tar.gz::https://github.com/php/pecl-math-stats/archive/$_commit.tar.gz"
builddir="$srcdir"/pecl-math-stats-$_commit
#source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
#builddir="$srcdir"/$_pkgreal-$pkgver
provides="php7-stats=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-stats" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=php-config7
	make
}

check() {
	php7 -dextension=modules/$_extname.so --ri $_extname
	case "$CARCH" in
		# Remove test fail https://bugs.php.net/bug.php?id=76163
		aarch64 | ppc64le) rm tests/stats_stat_correlation.phpt
	esac
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php7/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/60_$_extname.ini
}

sha512sums="0f359761512aa3c11bad1aa4c812e9a6a35d8e659b9aab4a38e5218dab5d7a33ebe349d9a6f25c9bfa361989281c68988f22988d3d4a357a610700c99897881c  php-pecl-stats-fac78cf926bb00c9974379c7131c58b7545e5b15.tar.gz"
